<?php

namespace App;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;

class User extends Authenticatable
{
    use Notifiable;
    public $timestamps = false;
    protected $fillable = ['firstname', 'lastname', 'email','scope','is_admin','password'];
    protected $hidden = ['password', 'api_token'];

    public function events(){
        return $this->belongsToMany('App\Event','App\UserEvent')
            ->withPivot('response');
    }

    public function getPhotoAttribute(){
        return config('app.url').$this->attributes['photo'];
    }
}
